}
static void
-demo_application_window_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+demo_application_window_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
- GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation,
+ GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget,
+ width,
+ height,
baseline);
if (!window->maximized && !window->fullscreen)
}
static void
-gtk_fishbowl_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_fishbowl_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
continue;
gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
- child_allocation.x = allocation->x + round (child->x * (allocation->width - child_requisition.width));
- child_allocation.y = allocation->y + round (child->y * (allocation->height - child_requisition.height));
+ child_allocation.x = round (child->x * (width - child_requisition.width));
+ child_allocation.y = round (child->y * (height - child_requisition.height));
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
}
static void
-drawing_area_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+drawing_area_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
DrawingArea *area = (DrawingArea *) widget;
- drawing_area_ensure_surface (area, allocation->width, allocation->height);
+ drawing_area_ensure_surface (area, width, height);
- GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, allocation, baseline);
+ GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, width, height, baseline);
}
static void
/* Translate GtkWidget::size-allocate to AtkComponent::bounds-changed */
static void
-size_allocate_cb (GtkWidget *widget,
- GtkAllocation *allocation)
+size_allocate_cb (GtkWidget *widget,
+ int width,
+ int height)
{
AtkObject* accessible;
AtkRectangle rect;
accessible = gtk_widget_get_accessible (widget);
if (ATK_IS_COMPONENT (accessible))
{
- rect.x = allocation->x;
- rect.y = allocation->y;
- rect.width = allocation->width;
- rect.height = allocation->height;
+ GtkAllocation alloc;
+ gtk_widget_get_allocation (widget, &alloc);
+
+ rect.x = alloc.x;
+ rect.y = alloc.y;
+ rect.width = alloc.width;
+ rect.height = alloc.height;
+
g_signal_emit_by_name (accessible, "bounds-changed", &rect);
}
}
G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_WIDGET)
static void
-gtk_accel_label_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_accel_label_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkAccelLabel *al = GTK_ACCEL_LABEL (widget);
GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (al);
- gtk_widget_size_allocate (priv->box, allocation, baseline);
+ gtk_widget_size_allocate (priv->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ },baseline);
}
static void
}
static void
-gtk_action_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_action_bar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (widget));
- gtk_widget_size_allocate (priv->revealer, allocation, baseline);
+ gtk_widget_size_allocate (priv->revealer,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ },
+ baseline);
}
static void
}
static void
-gtk_app_chooser_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_app_chooser_button_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkAppChooserButton *button = GTK_APP_CHOOSER_BUTTON (widget);
GtkAppChooserButtonPrivate *priv = gtk_app_chooser_button_get_instance_private (button);
- gtk_widget_size_allocate (priv->combobox, allocation, baseline);
+ gtk_widget_size_allocate (priv->combobox, &(GtkAllocation){0, 0, width, height}, baseline);
}
static void
}
static void
-gtk_app_chooser_widget_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+gtk_app_chooser_widget_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
int baseline)
{
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (widget);
GtkAppChooserWidgetPrivate *priv = gtk_app_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, allocation, baseline);
+ GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, width, height, baseline);
- gtk_widget_size_allocate (priv->overlay, allocation, baseline);
+ gtk_widget_size_allocate (priv->overlay,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ },baseline);
}
static void
static void
gtk_application_window_real_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline)
{
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
gint menubar_height;
GtkWidget *child;
- _gtk_window_set_allocation (GTK_WINDOW (widget), allocation, &child_allocation);
+ _gtk_window_set_allocation (GTK_WINDOW (widget), width, height, &child_allocation);
menubar_allocation = child_allocation;
gtk_widget_measure (window->priv->menubar, GTK_ORIENTATION_VERTICAL,
}
else
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->size_allocate (widget,
- allocation,
+ width,
+ height,
baseline);
}
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_button_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_button_box_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_button_box_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_button_box_set_child_property (GtkContainer *container,
}
static void
-gtk_button_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_button_box_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkButtonBox *bbox = GTK_BUTTON_BOX (widget);
GtkButtonBoxPrivate *priv = bbox->priv;
gint y = 0;
gint secondary_x = 0;
gint secondary_y = 0;
- gint width = 0;
- gint height = 0;
gint childspacing = 0;
gint spacing;
GtkOrientation orientation;
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
{
GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget,
- allocation,
+ width, height,
baseline);
return;
}
/* keep baseline as is */
break;
case GTK_BASELINE_POSITION_CENTER:
- baseline = baseline + (allocation->height - baseline_height) / 2;
+ baseline = baseline + (height - baseline_height) / 2;
break;
case GTK_BASELINE_POSITION_BOTTOM:
- baseline = allocation->height - (baseline_height - baseline);
+ baseline = height - (baseline_height - baseline);
break;
}
}
total_size = primary_size + secondary_size;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- width = allocation->width;
+ width = width;
else
- height = allocation->height;
+ height = height;
switch (priv->layout_style)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
childspacing = (width - total_size) / (nvis_children + 1);
- x = allocation->x + childspacing;
+ x = childspacing;
secondary_x = x + primary_size + n_primaries * childspacing;
}
else
{
childspacing = (height - total_size) / (nvis_children + 1);
- y = allocation->y + childspacing;
+ y = childspacing;
secondary_y = y + primary_size + n_primaries * childspacing;
}
if (nvis_children >= 2)
{
childspacing = (width - total_size) / (nvis_children - 1);
- x = allocation->x;
+ x = 0;
secondary_x = x + primary_size + n_primaries * childspacing;
}
else if (nvis_children == 1)
{
/* one child, just center */
childspacing = width;
- x = secondary_x = allocation->x
- + (allocation->width - widths[0]) / 2;
+ x = secondary_x = (width - widths[0]) / 2;
}
else
{
/* zero children, meh */
childspacing = width;
- x = secondary_x = allocation->x + allocation->width / 2;
+ x = secondary_x = width / 2;
}
}
else
if (nvis_children >= 2)
{
childspacing = (height - total_size) / (nvis_children - 1);
- y = allocation->y;
+ y = 0;
secondary_y = y + primary_size + n_primaries * childspacing;
}
else if (nvis_children == 1)
{
/* one child, just center */
childspacing = height;
- y = secondary_y = allocation->y
- + (allocation->height - heights[0]) / 2;
+ y = secondary_y = 0
+ + (height - heights[0]) / 2;
}
else
{
/* zero children, meh */
childspacing = height;
- y = secondary_y = allocation->y + allocation->height / 2;
+ y = secondary_y = 0 + height / 2;
}
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
childspacing = spacing;
- x = allocation->x;
- secondary_x = allocation->x + allocation->width
+ x = 0;
+ secondary_x = 0 + width
- secondary_size - spacing * (n_secondaries - 1);
}
else
{
childspacing = spacing;
- y = allocation->y;
- secondary_y = allocation->y + allocation->height
+ y = 0;
+ secondary_y = 0 + height
- secondary_size - spacing * (n_secondaries - 1);
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
childspacing = spacing;
- x = allocation->x + allocation->width
+ x = 0 + width
- primary_size - spacing * (n_primaries - 1);
- secondary_x = allocation->x;
+ secondary_x = 0;
}
else
{
childspacing = spacing;
- y = allocation->y + allocation->height
+ y = 0 + height
- primary_size - spacing * (n_primaries - 1);
- secondary_y = allocation->y;
+ secondary_y = 0;
}
break;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
childspacing = spacing;
- x = allocation->x +
- (allocation->width
+ x = 0 +
+ (width
- (primary_size + spacing * (n_primaries - 1))) / 2
+ (secondary_size + n_secondaries * spacing) / 2;
- secondary_x = allocation->x;
+ secondary_x = 0;
}
else
{
childspacing = spacing;
- y = allocation->y +
- (allocation->height
+ y = 0 +
+ (height
- (primary_size + spacing * (n_primaries - 1))) / 2
+ (secondary_size + n_secondaries * spacing) / 2;
- secondary_y = allocation->y;
+ secondary_y = 0;
}
break;
{
if (baselines[i] != -1)
{
- child_allocation.y = allocation->y + baseline - baselines[i];
+ child_allocation.y = 0 + baseline - baselines[i];
child_baseline = baselines[i];
}
else
- child_allocation.y = allocation->y + (allocation->height - child_allocation.height) / 2;
+ child_allocation.y = 0 + (height - child_allocation.height) / 2;
if (gtk_button_box_get_child_secondary (bbox, child))
{
}
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- child_allocation.x = (allocation->x + allocation->width)
- - (child_allocation.x + child_allocation.width - allocation->x);
+ child_allocation.x = (0 + width)
+ - (child_allocation.x + child_allocation.width - 0);
}
else
{
- child_allocation.x = allocation->x + (allocation->width - child_allocation.width) / 2;
+ child_allocation.x = 0 + (width - child_allocation.width) / 2;
if (gtk_button_box_get_child_secondary (bbox, child))
{
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
static void
-gtk_bin_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_bin_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkBin *bin = GTK_BIN (widget);
GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
if (priv->child && gtk_widget_get_visible (priv->child))
- gtk_widget_size_allocate (priv->child, allocation, baseline);
+ gtk_widget_size_allocate (priv->child,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
guint pack : 1;
};
-static void gtk_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_box_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_box_set_property (GObject *object,
guint prop_id,
}
static void
-gtk_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_box_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkBox *box = GTK_BOX (widget);
GtkBoxPrivate *priv = gtk_box_get_instance_private (box);
spacing = get_spacing (box);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- extra_space = allocation->width - (nvis_children - 1) * spacing;
+ extra_space = width - (nvis_children - 1) * spacing;
else
- extra_space = allocation->height - (nvis_children - 1) * spacing;
+ extra_space = height - (nvis_children - 1) * spacing;
have_baseline = FALSE;
minimum_above = natural_above = 0;
gtk_widget_measure (child->widget,
priv->orientation,
- priv->orientation == GTK_ORIENTATION_HORIZONTAL ?
- allocation->height : allocation->width,
+ priv->orientation == GTK_ORIENTATION_HORIZONTAL ? height : width,
&sizes[i].minimum_size, &sizes[i].natural_size,
NULL, NULL);
* and any of the child widgets explicitly request one */
if (baseline == -1 && have_baseline)
{
- gint height = allocation->height;
-
/* TODO: This is purely based on the minimum baseline, when things fit we should
use the natural one? */
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
child_allocation.y = 0;
- child_allocation.height = allocation->height;
+ child_allocation.height = height;
if (packing == GTK_PACK_START)
x = 0;
else
- x = allocation->width;
+ x = width;
}
else
{
child_allocation.x = 0;
- child_allocation.width = allocation->width;
+ child_allocation.width = width;
if (packing == GTK_PACK_START)
y = 0;
else
- y = allocation->height;
+ y = height;
}
for (i = 0, children = priv->children;
}
if (direction == GTK_TEXT_DIR_RTL)
- child_allocation.x = allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
+ child_allocation.x = width - child_allocation.x - child_allocation.width;
}
else /* (priv->orientation == GTK_ORIENTATION_VERTICAL) */
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_calendar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_calendar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_calendar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_calendar_button_press (GtkGestureMultiPress *gesture,
}
static void
-gtk_calendar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_calendar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = calendar->priv;
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
{
priv->day_width = (priv->min_day_width
- * ((allocation->width - (inner_border * 2)
+ * ((width - (inner_border * 2)
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2))
/ (7 * priv->min_day_width + priv->max_week_char_width * 2));
- priv->week_width = ((allocation->width - (inner_border * 2)
+ priv->week_width = ((width - (inner_border * 2)
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2 )
- priv->day_width * 7 + CALENDAR_MARGIN + calendar_xsep);
}
else
{
- priv->day_width = (allocation->width
+ priv->day_width = (width
- (inner_border * 2)
- (CALENDAR_MARGIN * 2)
- (DAY_XSEP * 6))/7;
GParamSpec *pspec);
static void gtk_cell_view_finalize (GObject *object);
static void gtk_cell_view_dispose (GObject *object);
-static void gtk_cell_view_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_cell_view_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_cell_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_cell_view_set_value (GtkCellView *cell_view,
}
static void
-gtk_cell_view_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_cell_view_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkCellView *cellview;
GtkCellViewPrivate *priv;
- gint alloc_width, alloc_height, width, height;
+ gint alloc_width, alloc_height;
cellview = GTK_CELL_VIEW (widget);
priv = cellview->priv;
- width = allocation->width;
- height = allocation->height;
-
gtk_cell_area_context_get_allocation (priv->context, &alloc_width, &alloc_height);
/* The first cell view in context is responsible for allocating the context at
*/
if (priv->fit_model)
gtk_cell_area_context_allocate (priv->context, width, height);
- else if (alloc_width != allocation->width && priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ else if (alloc_width != width && priv->orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_cell_area_context_allocate (priv->context, width, -1);
- else if (alloc_height != allocation->height && priv->orientation == GTK_ORIENTATION_VERTICAL)
+ else if (alloc_height != height && priv->orientation == GTK_ORIENTATION_VERTICAL)
gtk_cell_area_context_allocate (priv->context, -1, height);
}
}
static void
-gtk_center_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_center_box_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkCenterBox *self = GTK_CENTER_BOX (widget);
GtkAllocation child_allocation;
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- size = allocation->width;
- for_size = allocation->height;
+ size = width;
+ for_size = height;
}
else
{
- size = allocation->height;
- for_size = allocation->width;
+ size = height;
+ for_size = width;
baseline = -1;
}
baseline = min_above;
break;
case GTK_BASELINE_POSITION_CENTER:
- baseline = min_above + (allocation->height - (min_above + min_below)) / 2;
+ baseline = min_above + (height - (min_above + min_below)) / 2;
break;
case GTK_BASELINE_POSITION_BOTTOM:
- baseline = allocation->height - min_below;
+ baseline = height - min_below;
break;
}
}
child_pos[1] = size - child_size[1] - child_size[2];
}
- child_allocation = *allocation;
+ child_allocation = (GtkAllocation) { 0, 0, width, height };
for (i = 0; i < 3; i++)
{
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- child_allocation.x = allocation->x + child_pos[i];
- child_allocation.y = allocation->y;
+ child_allocation.x = child_pos[i];
+ child_allocation.y = 0;
child_allocation.width = child_size[i];
- child_allocation.height = allocation->height;
+ child_allocation.height = height;
}
else
{
- child_allocation.x = allocation->x;
- child_allocation.y = allocation->y + child_pos[i];
- child_allocation.width = allocation->width;
+ child_allocation.x = 0;
+ child_allocation.y = child_pos[i];
+ child_allocation.width = width;
child_allocation.height = child_size[i];
}
- gtk_widget_size_allocate (child[i], &child_allocation, allocation->y + baseline);
+ gtk_widget_size_allocate (child[i], &child_allocation, baseline);
}
}
* in this case.
*/
-
-static void gtk_check_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
-
typedef struct {
GtkWidget *indicator_widget;
}
}
+static void
+gtk_check_button_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
+{
+ GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
+ GtkAllocation child_alloc = { 0 };
+ GtkWidget *child;
+ gboolean is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
+ int x = 0;
+
+ if (priv->draw_indicator)
+ {
+ child_alloc.y = 0;
+ child_alloc.height = height;
+
+ gtk_widget_measure (priv->indicator_widget, GTK_ORIENTATION_HORIZONTAL, -1,
+ &child_alloc.width, NULL, NULL, NULL);
+
+ if (is_rtl)
+ {
+ x = 0;
+ child_alloc.x = width - child_alloc.width;
+ }
+ else
+ {
+ x = child_alloc.width;
+ child_alloc.x = 0;
+ }
+
+ gtk_widget_size_allocate (priv->indicator_widget, &child_alloc, baseline);
+ }
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child)
+ {
+ child_alloc.x = x;
+ child_alloc.y = 0;
+ child_alloc.width = width - child_alloc.width; /* Indicator width */
+ child_alloc.height = height;
+
+ gtk_widget_size_allocate (child, &child_alloc, baseline);
+ }
+}
+
+
+
static void
gtk_check_button_set_property (GObject *object,
guint prop_id,
NULL);
}
-static void
-gtk_check_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
-{
- GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
- GtkAllocation child_alloc = { 0 };
- GtkWidget *child;
- gboolean is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
- int x = 0;
-
- if (priv->draw_indicator)
- {
- child_alloc.y = allocation->y;
- child_alloc.height = allocation->height;
-
- gtk_widget_measure (priv->indicator_widget, GTK_ORIENTATION_HORIZONTAL, -1,
- &child_alloc.width, NULL, NULL, NULL);
-
- if (is_rtl)
- {
- x = 0;
- child_alloc.x = allocation->x + allocation->width - child_alloc.width;
- }
- else
- {
- x = child_alloc.width;
- child_alloc.x = allocation->x;
- }
-
- gtk_widget_size_allocate (priv->indicator_widget, &child_alloc, baseline);
- }
-
- child = gtk_bin_get_child (GTK_BIN (widget));
- if (child)
- {
- child_alloc.x = allocation->x + x;
- child_alloc.y = allocation->y;
- child_alloc.width = allocation->width - child_alloc.width; /* Indicator width */
- child_alloc.height = allocation->height;
-
- gtk_widget_size_allocate (child, &child_alloc, baseline);
- }
-}
-
GtkCssNode *
gtk_check_button_get_indicator_node (GtkCheckButton *check_button)
{
G_ADD_PRIVATE (GtkCheckMenuItem))
static void
-gtk_check_menu_item_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_check_menu_item_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkAllocation indicator_alloc;
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
gint toggle_size;
GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget,
- allocation,
+ width,
+ height,
baseline);
gtk_widget_measure (priv->indicator_widget,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
indicator_alloc.x = (toggle_size - indicator_alloc.width) / 2;
else
- indicator_alloc.x = allocation->width - toggle_size +
+ indicator_alloc.x = width - toggle_size +
(toggle_size - indicator_alloc.width) / 2;
- indicator_alloc.y = (allocation->height - indicator_alloc.height) / 2;
+ indicator_alloc.y = (height - indicator_alloc.height) / 2;
gtk_widget_size_allocate (priv->indicator_widget,
&indicator_alloc,
}
static void
-gtk_color_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_color_button_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkColorButton *button = GTK_COLOR_BUTTON (widget);
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
- gtk_widget_size_allocate (priv->button, allocation, baseline);
+ gtk_widget_size_allocate (priv->button,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ },
+ baseline);
}
static void
}
static void
-plane_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+plane_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
}
static void
-swatch_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+swatch_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
GtkColorSwatchPrivate *priv = gtk_color_swatch_get_instance_private (swatch);
- gtk_widget_size_allocate (priv->overlay_widget, allocation, -1);
+ gtk_widget_size_allocate (priv->overlay_widget,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, -1);
}
static void
}
static void
-gtk_combo_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_combo_box_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
- gtk_widget_size_allocate (priv->box, allocation, baseline);
+ gtk_widget_size_allocate (priv->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
if (gtk_widget_get_visible (priv->popup_widget))
{
NULL, &menu_width, NULL, NULL);
gtk_widget_set_size_request (priv->popup_widget,
- MAX (allocation->width, menu_width), -1);
+ MAX (width, menu_width), -1);
}
/* reposition the menu after giving it a new width */
static void gtk_entry_realize (GtkWidget *widget);
static void gtk_entry_unrealize (GtkWidget *widget);
static void gtk_entry_unmap (GtkWidget *widget);
-static void gtk_entry_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_entry_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_entry_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_entry_focus_in (GtkWidget *widget);
GTK_WIDGET_CLASS (gtk_entry_parent_class)->unmap (widget);
}
-static void
+static void
gtk_entry_get_text_allocation (GtkEntry *entry,
GdkRectangle *allocation)
{
}
static void
-gtk_entry_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_entry_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
priv->text_baseline = baseline;
priv->text_x = 0;
- priv->text_width = allocation->width;
+ priv->text_width = width;
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
GtkAllocation icon_alloc;
- int width;
+ int icon_width;
if (!icon_info)
continue;
gtk_widget_measure (icon_info->widget,
GTK_ORIENTATION_HORIZONTAL,
-1,
- NULL, &width,
+ NULL, &icon_width,
NULL, NULL);
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && i == GTK_ENTRY_ICON_PRIMARY) ||
(gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR && i == GTK_ENTRY_ICON_SECONDARY))
{
- icon_alloc.x = allocation->x + priv->text_x + priv->text_width - width;
+ icon_alloc.x = priv->text_x + priv->text_width - icon_width;
}
else
{
- icon_alloc.x = allocation->x + priv->text_x;
- priv->text_x += width;
+ icon_alloc.x = priv->text_x;
+ priv->text_x += icon_width;
}
icon_alloc.y = 0;
- icon_alloc.width = width;
- icon_alloc.height = allocation->height;
- priv->text_width -= width;
+ icon_alloc.width = icon_width;
+ icon_alloc.height = height;
+ priv->text_width -= icon_width;
gtk_widget_size_allocate (icon_info->widget, &icon_alloc, baseline);
}
&min, &nat,
NULL, NULL);
progress_alloc.x = 0;
- progress_alloc.y = allocation->height - nat;
- progress_alloc.width = allocation->width;
+ progress_alloc.y = height - nat;
+ progress_alloc.width = width;
progress_alloc.height = nat;
gtk_widget_size_allocate (priv->progress_widget, &progress_alloc, -1);
GParamSpec *pspec);
static void gtk_expander_destroy (GtkWidget *widget);
-static void gtk_expander_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_expander_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static gboolean gtk_expander_focus (GtkWidget *widget,
GtkDirectionType direction);
static gboolean gtk_expander_drag_motion (GtkWidget *widget,
}
static void
-gtk_expander_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_expander_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkExpanderPrivate *priv = gtk_expander_get_instance_private (GTK_EXPANDER (widget));
- gtk_widget_size_allocate (priv->box, allocation, baseline);
+ gtk_widget_size_allocate (priv->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
}
static void
-gtk_file_chooser_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_file_chooser_button_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
- gtk_widget_size_allocate (priv->child, allocation, baseline);
+ gtk_widget_size_allocate (priv->child,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
static void gtk_file_chooser_dialog_map (GtkWidget *widget);
static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
-static void gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+static void gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
int baseline);
static void file_chooser_widget_file_activated (GtkFileChooser *chooser,
GtkFileChooserDialog *dialog);
}
static void
-gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget,
- allocation,
+ width,
+ height,
baseline);
if (gtk_widget_is_drawable (widget))
save_dialog_geometry (GTK_FILE_CHOOSER_DIALOG (widget));
}
static void
-gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkFileChooserWidget *self = GTK_FILE_CHOOSER_WIDGET (widget);
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget,
- allocation,
- baseline);
-
- gtk_widget_size_allocate (priv->box, allocation, -1);
+ gtk_widget_size_allocate (priv->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ },-1);
}
static void
int *natural_baseline);
-static void gtk_fixed_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_fixed_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_fixed_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_fixed_remove (GtkContainer *container,
}
static void
-gtk_fixed_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_fixed_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkWidget *child;
GtkFixedChild *child_info;
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
}
-static void
-gtk_flow_box_child_measure (GtkWidget *widget,
- GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline)
-{
- GtkWidget *child;
-
- child = gtk_bin_get_child (GTK_BIN (widget));
- if (!child || ! gtk_widget_get_visible (child))
- {
- *minimum = *natural = 0;
- return;
- }
-
- gtk_widget_measure (child, orientation, for_size,
- minimum, natural, minimum_baseline, natural_baseline);
-}
-
-static void
-gtk_flow_box_child_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
-{
- GtkWidget *child;
-
- child = gtk_bin_get_child (GTK_BIN (widget));
- if (child && gtk_widget_get_visible (child))
- gtk_widget_size_allocate (child, allocation, -1);
-}
-
/* GObject implementation {{{2 */
static void
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
widget_class->get_request_mode = gtk_flow_box_child_get_request_mode;
- widget_class->measure = gtk_flow_box_child_measure;
- widget_class->size_allocate = gtk_flow_box_child_size_allocate;
widget_class->focus = gtk_flow_box_child_focus;
class->activate = gtk_flow_box_child_activate;
}
static void
-gtk_flow_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_flow_box_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkFlowBox *box = GTK_FLOW_BOX (widget);
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- avail_size = allocation->width;
- avail_other_size = allocation->height;
+ avail_size = width;
+ avail_other_size = height;
item_spacing = priv->column_spacing; line_spacing = priv->row_spacing;
}
else /* GTK_ORIENTATION_VERTICAL */
{
- avail_size = allocation->height;
- avail_other_size = allocation->width;
+ avail_size = height;
+ avail_other_size = width;
item_spacing = priv->row_spacing;
line_spacing = priv->column_spacing;
}
}
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- child_allocation.x = allocation->width - child_allocation.x - child_allocation.width;
+ child_allocation.x = width - child_allocation.x - child_allocation.width;
gtk_widget_size_allocate (child, &child_allocation, -1);
}
static void
-gtk_font_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+gtk_font_button_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
int baseline)
{
GtkFontButton *button = GTK_FONT_BUTTON (widget);
GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (button);
- gtk_widget_size_allocate (priv->button, allocation, baseline);
+ gtk_widget_size_allocate (priv->button,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ },
+ baseline);
}
static void
}
static void
-gtk_font_chooser_widget_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_font_chooser_widget_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
+
{
GtkFontChooserWidget *self = GTK_FONT_CHOOSER_WIDGET (widget);
GtkFontChooserWidgetPrivate *priv = gtk_font_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->size_allocate (widget, allocation, -1);
-
- gtk_widget_size_allocate (priv->stack, allocation, -1);
+ gtk_widget_size_allocate (priv->stack,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, -1);
}
static void
guint param_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_frame_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_frame_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_frame_remove (GtkContainer *container,
GtkWidget *child);
static void gtk_frame_forall (GtkContainer *container,
}
static void
-gtk_frame_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_frame_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkFrame *frame = GTK_FRAME (widget);
GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
gtk_widget_get_visible (priv->label_widget))
{
GtkAllocation label_allocation;
- int nat_width, width, height;
+ int nat_width, label_width, label_height;
float xalign;
if (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
gtk_widget_measure (priv->label_widget, GTK_ORIENTATION_HORIZONTAL, -1,
NULL, &nat_width, NULL, NULL);
- width = MIN (new_allocation.width, nat_width);
+ label_width = MIN (new_allocation.width, nat_width);
gtk_widget_measure (priv->label_widget, GTK_ORIENTATION_VERTICAL, width,
- &height, NULL, NULL, NULL);
+ &label_height, NULL, NULL, NULL);
label_allocation.x = new_allocation.x + (new_allocation.width - width) * xalign;
- label_allocation.y = new_allocation.y - height;
- label_allocation.height = height;
- label_allocation.width = width;
+ label_allocation.y = new_allocation.y - label_height;
+ label_allocation.height = label_height;
+ label_allocation.width = label_width;
gtk_widget_size_allocate (priv->label_widget, &label_allocation, -1);
}
}
static void
-gtk_gizmo_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_gizmo_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkGizmo *self = GTK_GIZMO (widget);
if (self->allocate_func)
- self->allocate_func (self,
- allocation,
- baseline);
+ self->allocate_func (self, width, height, baseline);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-typedef void (* GtkGizmoAllocateFunc) (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline);
+typedef void (* GtkGizmoAllocateFunc) (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline);
typedef gboolean (* GtkGizmoSnapshotFunc) (GtkGizmo *gizmo,
GtkSnapshot *snapshot);
}
static void
-gtk_gl_area_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_gl_area_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkGLArea *area = GTK_GL_AREA (widget);
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
- GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, allocation, baseline);
+ GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, width, height, baseline);
if (gtk_widget_get_realized (widget))
priv->needs_resize = TRUE;
}
static void
-gtk_grid_request_allocate_children (GtkGridRequest *request,
- const GtkAllocation *allocation)
+gtk_grid_request_allocate_children (GtkGridRequest *request,
+ int grid_width,
+ int grid_height)
{
GtkWidget *child;
GtkAllocation child_allocation;
child_allocation.height = height;
if (_gtk_widget_get_direction (GTK_WIDGET (request->grid)) == GTK_TEXT_DIR_RTL)
- child_allocation.x = allocation->x + allocation->width
- - (child_allocation.x - allocation->x) - child_allocation.width;
+ child_allocation.x = grid_width - child_allocation.x - child_allocation.width;
gtk_widget_size_allocate (child, &child_allocation, baseline);
}
}
-#define GET_SIZE(allocation, orientation) (orientation == GTK_ORIENTATION_HORIZONTAL ? allocation->width : allocation->height)
+#define GET_SIZE(width, height, orientation) (orientation == GTK_ORIENTATION_HORIZONTAL ? width : height)
static void
-gtk_grid_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_grid_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkGrid *grid = GTK_GRID (widget);
GtkGridRequest request;
orientation = GTK_ORIENTATION_VERTICAL;
gtk_grid_request_run (&request, 1 - orientation, FALSE);
- gtk_grid_request_allocate (&request, 1 - orientation, GET_SIZE (allocation, 1 - orientation));
+ gtk_grid_request_allocate (&request, 1 - orientation, GET_SIZE (width, height, 1 - orientation));
gtk_grid_request_run (&request, orientation, TRUE);
- gtk_grid_request_allocate (&request, orientation, GET_SIZE (allocation, orientation));
+ gtk_grid_request_allocate (&request, orientation, GET_SIZE (width, height, orientation));
gtk_grid_request_position (&request, 0);
gtk_grid_request_position (&request, 1);
- gtk_grid_request_allocate_children (&request, allocation);
+ gtk_grid_request_allocate_children (&request, width, height);
}
static void
}
static void
-gtk_header_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_header_bar_size_allocate (GtkWidget *widget,
+ int widget_width,
+ int widget_height,
+ int baseline)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
GtkWidget *title_widget;
nvis_children = count_visible_children (bar);
sizes = g_newa (GtkRequestedSize, nvis_children);
- width = allocation->width - nvis_children * priv->spacing;
- height = allocation->height;
+ width = widget_width - nvis_children * priv->spacing;
+ height = widget_height;
i = 0;
for (l = priv->children; l; l = l->next)
{
gint side_free_space;
- side_free_space = allocation->width / 2 - title_natural_size / 2 - side[packing];
+ side_free_space = widget_width / 2 - title_natural_size / 2 - side[packing];
if (side_free_space > 0 && nexpand_children[packing] > 0)
{
/* allocate the children on both sides of the title */
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; packing++)
{
- child_allocation.y = allocation->y;
+ child_allocation.y = 0;
child_allocation.height = height;
if (packing == GTK_PACK_START)
- x = allocation->x + start_width;
+ x = start_width;
else
- x = allocation->x + allocation->width - end_width;
+ x = widget_width - end_width;
i = 0;
for (l = priv->children; l != NULL; l = l->next)
}
if (direction == GTK_TEXT_DIR_RTL)
- child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
+ child_allocation.x = widget_width - child_allocation.x - child_allocation.width;
gtk_widget_size_allocate (child->widget, &child_allocation, baseline);
/* We don't enforce css borders on the center widget, to make
* title/subtitle combinations fit without growing the header
*/
- child_allocation.y = allocation->y;
- child_allocation.height = allocation->height;
+ child_allocation.y = 0;
+ child_allocation.height = widget_height;
- child_size = MIN (allocation->width - side[0] - side[1], title_natural_size);
+ child_size = MIN (widget_width - side[0] - side[1], title_natural_size);
- child_allocation.x = allocation->x + (allocation->width - child_size) / 2;
+ child_allocation.x = (widget_width - child_size) / 2;
child_allocation.width = child_size;
/* if the title widget is expanded, then grow it by all the available
child_allocation.x -= width / 2;
}
- if (allocation->x + side[0] > child_allocation.x)
- child_allocation.x = allocation->x + side[0];
- else if (allocation->x + allocation->width - side[1] < child_allocation.x + child_allocation.width)
- child_allocation.x = allocation->x + allocation->width - side[1] - child_allocation.width;
+ if (side[0] > child_allocation.x)
+ child_allocation.x = side[0];
+ else if (widget_width - side[1] < child_allocation.x + child_allocation.width)
+ child_allocation.x = widget_width - side[1] - child_allocation.width;
if (direction == GTK_TEXT_DIR_RTL)
- child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
+ child_allocation.x = widget_width - (child_allocation.x) - child_allocation.width;
if (title_widget != NULL)
{
gtk_widget_size_allocate (title_widget, &child_allocation, baseline);
}
- child_allocation.y = allocation->y;
+ child_allocation.y = 0;
child_allocation.height = height;
if (priv->titlebar_start_box)
{
gboolean left = (direction == GTK_TEXT_DIR_LTR);
if (left)
- child_allocation.x = allocation->x;
+ child_allocation.x = 0;
else
- child_allocation.x = allocation->x + allocation->width - start_width + priv->spacing;
+ child_allocation.x = widget_width - start_width + priv->spacing;
child_allocation.width = start_width - priv->spacing;
gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation, baseline);
}
{
gboolean left = (direction != GTK_TEXT_DIR_LTR);
if (left)
- child_allocation.x = allocation->x;
+ child_allocation.x = 0;
else
- child_allocation.x = allocation->x + allocation->width - end_width + priv->spacing;
+ child_allocation.x = widget_width - end_width + priv->spacing;
child_allocation.width = end_width - priv->spacing;
gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation, baseline);
}
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_icon_view_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_icon_view_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_icon_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_icon_view_motion (GtkEventController *controller,
}
static void
-gtk_icon_view_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_icon_view_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
GParamSpec *pspec);
static void gtk_label_finalize (GObject *object);
static void gtk_label_destroy (GtkWidget *widget);
-static void gtk_label_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_label_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_label_state_flags_changed (GtkWidget *widget,
GtkStateFlags prev_state);
static void gtk_label_style_updated (GtkWidget *widget);
}
static void
-gtk_label_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_label_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkLabel *label = GTK_LABEL (widget);
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
if (priv->layout)
{
if (priv->ellipsize || priv->wrap)
- pango_layout_set_width (priv->layout,
- allocation->width * PANGO_SCALE);
+ pango_layout_set_width (priv->layout, width * PANGO_SCALE);
else
pango_layout_set_width (priv->layout, -1);
}
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_layout_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_layout_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_layout_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_layout_remove (GtkContainer *container,
static void
-gtk_layout_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_layout_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkLayout *layout = GTK_LAYOUT (widget);
GtkLayoutPrivate *priv = gtk_layout_get_instance_private (layout);
}
static void
-gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
- const GtkAllocation *allocation,
- int baseline)
+gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
+ int width,
+ int height,
+ int baseline)
{
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GtkAllocation block_area;
/* allocate the empty (unfilled) part */
gtk_widget_size_allocate (priv->block_widget[inverted ? 0 : 1],
- allocation,
+ &(GtkAllocation) {0, 0, width, height},
baseline);
if (priv->cur_value == 0)
return;
/* now allocate the filled part */
- block_area = *allocation;
+ block_area = (GtkAllocation) {0, 0, width, height};
fill_percentage = (priv->cur_value - priv->min_value) /
(priv->max_value - priv->min_value);
block_area.width = MAX (block_area.width, block_min);
if (inverted)
- block_area.x += allocation->width - block_area.width;
+ block_area.x += width - block_area.width;
}
else
{
block_area.height = MAX (block_area.height, block_min);
if (inverted)
- block_area.y += allocation->height - block_area.height;
+ block_area.y += height - block_area.height;
}
gtk_widget_size_allocate (priv->block_widget[inverted ? 1 : 0],
static void
gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
- const GtkAllocation *allocation,
- int baseline)
+ int width,
+ int height,
+ int baseline)
{
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GtkAllocation block_area;
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- block_width = MAX (block_width, (gint) floor (allocation->width / num_blocks));
- block_height = allocation->height;
+ block_width = MAX (block_width, (gint) floor (width / num_blocks));
+ block_height = height;
}
else
{
- block_width = allocation->width;
- block_height = MAX (block_height, (gint) floor (allocation->height / num_blocks));
+ block_width = width;
+ block_height = MAX (block_height, (gint) floor (height / num_blocks));
}
- block_area.x = allocation->x;
- block_area.y = allocation->y;
+ block_area.x = 0;
+ block_area.y = 0;
block_area.width = block_width;
block_area.height = block_height;
}
static void
-gtk_level_bar_allocate_trough (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline)
+gtk_level_bar_allocate_trough (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline)
{
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (widget));
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
- gtk_level_bar_allocate_trough_continuous (self, allocation, baseline);
+ gtk_level_bar_allocate_trough_continuous (self, width, height, baseline);
else
- gtk_level_bar_allocate_trough_discrete (self, allocation, baseline);
+ gtk_level_bar_allocate_trough_discrete (self, width, height, baseline);
}
static void
-gtk_level_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_level_bar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (GTK_LEVEL_BAR (widget));
- gtk_widget_size_allocate (priv->trough_widget, allocation, baseline);
+ gtk_widget_size_allocate (priv->trough_widget,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
static GType gtk_list_box_child_type (GtkContainer *container);
static GtkSizeRequestMode gtk_list_box_get_request_mode (GtkWidget *widget);
static void gtk_list_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline);
static void gtk_list_box_drag_leave (GtkWidget *widget,
GdkDrop *drop);
}
static void
-gtk_list_box_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_list_box_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkListBoxPrivate *priv = BOX_PRIV (widget);
GtkAllocation child_allocation;
int child_min;
- child_allocation.x = allocation->x;
- child_allocation.y = allocation->y;
- child_allocation.width = allocation->width;
+ child_allocation.x = 0;
+ child_allocation.y = 0;
+ child_allocation.width = width;
child_allocation.height = 0;
- header_allocation.x = allocation->x;
- header_allocation.y = allocation->y;
- header_allocation.width = allocation->width;
+ header_allocation.x = 0;
+ header_allocation.y = 0;
+ header_allocation.width = width;
header_allocation.height = 0;
if (priv->placeholder && gtk_widget_get_child_visible (priv->placeholder))
{
gtk_widget_measure (priv->placeholder, GTK_ORIENTATION_VERTICAL,
- allocation->width,
+ width,
&child_min, NULL, NULL, NULL);
- header_allocation.height = allocation->height;
+ header_allocation.height = height;
header_allocation.y = child_allocation.y;
gtk_widget_size_allocate (priv->placeholder, &header_allocation, -1);
child_allocation.y += child_min;
if (ROW_PRIV (row)->header != NULL)
{
gtk_widget_measure (ROW_PRIV (row)->header, GTK_ORIENTATION_VERTICAL,
- allocation->width,
+ width,
&child_min, NULL, NULL, NULL);
header_allocation.height = child_min;
header_allocation.y = child_allocation.y;
}
static void
-gtk_media_controls_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_media_controls_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkMediaControls *controls = GTK_MEDIA_CONTROLS (widget);
- gtk_widget_size_allocate (controls->box, allocation, baseline);
+ gtk_widget_size_allocate (controls->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
static void gtk_menu_destroy (GtkWidget *widget);
static void gtk_menu_realize (GtkWidget *widget);
static void gtk_menu_unrealize (GtkWidget *widget);
-static void gtk_menu_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_menu_size_allocate (GtkWidget *widget,
+ int widget_width,
+ int widget_height,
+ int baseline);
static void gtk_menu_show (GtkWidget *widget);
static void gtk_menu_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
}
static void
-gtk_menu_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_menu_size_allocate (GtkWidget *widget,
+ int widget_width,
+ int widget_height,
+ int baseline)
{
GtkMenu *menu;
GtkMenuPrivate *priv;
int base_width;
g_return_if_fail (GTK_IS_MENU (widget));
- g_return_if_fail (allocation != NULL);
menu = GTK_MENU (widget);
menu_shell = GTK_MENU_SHELL (widget);
g_free (priv->heights);
priv->heights_length = calculate_line_heights (menu,
- allocation->width,
+ widget_width,
&priv->heights,
NULL);
/* Show scroll arrows if necessary */
- if (priv->requested_height > allocation->height)
+ if (priv->requested_height > widget_height)
{
gtk_widget_set_child_visible (priv->top_arrow_widget, TRUE);
gtk_widget_set_child_visible (priv->bottom_arrow_widget, TRUE);
gtk_widget_set_child_visible (priv->bottom_arrow_widget, FALSE);
}
- x = allocation->x;
- y = allocation->y;
- width = allocation->width;
- height = allocation->height;
+ x = 0;
+ y = 0;
+ width = widget_width;
+ height = widget_height;
if (menu_shell->priv->active)
gtk_menu_scroll_to (menu, priv->scroll_offset);
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_menu_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_menu_bar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static gint gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell);
}
static void
-gtk_menu_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_menu_bar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkMenuBar *menu_bar = GTK_MENU_BAR (widget);
GtkMenuBarPrivate *priv = menu_bar->priv;
if (!menu_shell->priv->children)
return;
- remaining_space = *allocation;
+ remaining_space = (GtkAllocation) {0, 0, width, height};
requested_sizes = g_array_new (FALSE, FALSE, sizeof (GtkRequestedSize));
if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
}
static void
-gtk_menu_item_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_menu_item_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
GtkMenuItemPrivate *priv = menu_item->priv;
GtkWidget *parent;
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- g_return_if_fail (allocation != NULL);
direction = gtk_widget_get_direction (widget);
child = gtk_bin_get_child (GTK_BIN (widget));
if (child)
{
- child_allocation = *allocation;
+ child_allocation = (GtkAllocation) {0, 0, width, height};
if (child_pack_dir == GTK_PACK_DIRECTION_LTR ||
child_pack_dir == GTK_PACK_DIRECTION_RTL)
}
static void
-gtk_model_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_model_button_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
if (GTK_MODEL_BUTTON (widget)->iconic)
{
GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget,
- allocation,
+ width,
+ height,
baseline);
}
else
NULL, NULL);
if (indicator_is_left (widget))
- child_allocation.x = allocation->x;
+ child_allocation.x = 0;
else
- child_allocation.x = allocation->x + allocation->width - check_nat_width;
- child_allocation.y = allocation->y + (allocation->height - check_nat_height) / 2;
+ child_allocation.x = width - check_nat_width;
+ child_allocation.y = (height - check_nat_height) / 2;
child_allocation.width = check_nat_width;
child_allocation.height = check_nat_height;
border.right += check_nat_width;
}
- child_allocation.x = allocation->x + border.left;
- child_allocation.y = allocation->y + border.top;
- child_allocation.width = allocation->width - border.left - border.right;
- child_allocation.height = allocation->height - border.top - border.bottom;
+ child_allocation.x = border.left;
+ child_allocation.y = border.top;
+ child_allocation.width = width - border.left - border.right;
+ child_allocation.height = height - border.top - border.bottom;
if (baseline != -1)
baseline -= border.top;
int *minimum_baseline,
int *natural_baseline);
static void gtk_notebook_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline);
static gboolean gtk_notebook_popup_menu (GtkWidget *widget);
static void gtk_notebook_motion (GtkEventController *controller,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline);
-static void gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
+static void gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
+ int width,
+ int height,
int baseline);
static gboolean gtk_notebook_snapshot_tabs (GtkGizmo *gizmo,
GtkSnapshot *snapshot);
/*** GtkNotebook Size Allocate Functions ***/
static void gtk_notebook_pages_allocate (GtkNotebook *notebook,
- const GtkAllocation *allocation);
+ int width,
+ int height);
static void gtk_notebook_calc_tabs (GtkNotebook *notebook,
GList *start,
GList **end,
}
static void
-gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline)
+gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline)
{
GtkWidget *widget = gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
GtkNotebook *notebook = GTK_NOTEBOOK (gtk_widget_get_parent (widget));
- gtk_notebook_pages_allocate (notebook, allocation);
+ gtk_notebook_pages_allocate (notebook, width, height);
}
static void
-gtk_notebook_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_notebook_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
- gtk_widget_size_allocate (priv->box, allocation, -1);
+ gtk_widget_size_allocate (priv->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, -1);
}
static gboolean
}
static void
-allocate_tab (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline)
+allocate_tab (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline)
{
GtkNotebook *notebook = g_object_get_data (G_OBJECT (gizmo), "notebook");
GtkNotebookPrivate *priv = notebook->priv;
g_assert (page != NULL);
-
- child_allocation = *allocation;
+ child_allocation = (GtkAllocation) {0, 0, width, height};
if (!page->fill)
{
if (priv->tab_pos == GTK_POS_TOP || priv->tab_pos == GTK_POS_BOTTOM)
{
- gtk_widget_measure (page->tab_label, GTK_ORIENTATION_HORIZONTAL, allocation->height,
+ gtk_widget_measure (page->tab_label, GTK_ORIENTATION_HORIZONTAL, height,
NULL, &child_allocation.width, NULL, NULL);
- if (child_allocation.width > allocation->width)
- child_allocation.width = allocation->width;
+ if (child_allocation.width > width)
+ child_allocation.width = width;
else
- child_allocation.x += (allocation->width - child_allocation.width) / 2;
+ child_allocation.x += (width - child_allocation.width) / 2;
}
else
{
- gtk_widget_measure (page->tab_label, GTK_ORIENTATION_VERTICAL, allocation->width,
+ gtk_widget_measure (page->tab_label, GTK_ORIENTATION_VERTICAL, width,
NULL, &child_allocation.height, NULL, NULL);
- if (child_allocation.height > allocation->height)
- child_allocation.height = allocation->height;
+ if (child_allocation.height > height)
+ child_allocation.height = height;
else
- child_allocation.y += (allocation->height - child_allocation.height) / 2;
+ child_allocation.y += (height - child_allocation.height) / 2;
}
}
static void
-gtk_notebook_tab_space (GtkNotebook *notebook,
- const GtkAllocation *allocation,
- gboolean *show_arrows,
- GtkAllocation *tabs_allocation,
- gint *tab_space)
+gtk_notebook_tab_space (GtkNotebook *notebook,
+ int notebook_width,
+ int notebook_height,
+ gboolean *show_arrows,
+ GtkAllocation *tabs_allocation,
+ gint *tab_space)
{
GtkNotebookPrivate *priv = notebook->priv;
GList *children;
children = priv->children;
- *tabs_allocation = *allocation;
+ *tabs_allocation = (GtkAllocation) {0, 0, notebook_width, notebook_height};
switch (tab_pos)
{
}
static void
-gtk_notebook_pages_allocate (GtkNotebook *notebook,
- const GtkAllocation *allocation)
+gtk_notebook_pages_allocate (GtkNotebook *notebook,
+ int width,
+ int height)
{
GtkNotebookPrivate *priv = notebook->priv;
GList *children = NULL;
tab_space = remaining_space = 0;
expanded_tabs = 1;
- gtk_notebook_tab_space (notebook, allocation,
+ gtk_notebook_tab_space (notebook, width, height,
&showarrow, &tabs_allocation, &tab_space);
gtk_notebook_calculate_shown_tabs (notebook, showarrow,
}
static void
-gtk_overlay_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_overlay_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkOverlay *overlay = GTK_OVERLAY (widget);
GtkWidget *child;
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
if (main_widget && gtk_widget_get_visible (main_widget))
- gtk_widget_size_allocate (main_widget, allocation, -1);
+ gtk_widget_size_allocate (main_widget,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, -1);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
int *minimum_baseline,
int *natural_baseline);
static void gtk_paned_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline);
static void gtk_paned_unrealize (GtkWidget *widget);
static void gtk_paned_snapshot (GtkWidget *widget,
}
static void
-flip_child (const GtkAllocation *allocation,
- GtkAllocation *child_pos)
+flip_child (int width,
+ GtkAllocation *child_pos)
{
- int width;
-
- width = allocation->width;
-
child_pos->x = width - child_pos->x - child_pos->width;
}
}
static void
-gtk_paned_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_paned_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkPaned *paned = GTK_PANED (widget);
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
gint child1_width, child2_width;
gtk_widget_measure (priv->child1, GTK_ORIENTATION_HORIZONTAL,
- allocation->height,
+ height,
&child1_width, NULL, NULL, NULL);
gtk_widget_measure (priv->child2, GTK_ORIENTATION_HORIZONTAL,
- allocation->height,
+ height,
&child2_width, NULL, NULL, NULL);
gtk_paned_calc_position (paned,
- MAX (1, allocation->width - handle_size),
+ MAX (1, width - handle_size),
child1_width,
child2_width);
priv->child1_size,
0,
handle_size,
- allocation->height
+ height
};
- child1_allocation.height = child2_allocation.height = allocation->height;
+ child1_allocation.height = child2_allocation.height = height;
child1_allocation.width = MAX (1, priv->child1_size);
child1_allocation.x = 0;
child1_allocation.y = child2_allocation.y = 0;
child2_allocation.x = child1_allocation.x + priv->child1_size + handle_size;
- child2_allocation.width = MAX (1, allocation->width - priv->child1_size - handle_size);
+ child2_allocation.width = MAX (1, width - priv->child1_size - handle_size);
if (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL)
{
- flip_child (allocation, &(child2_allocation));
- flip_child (allocation, &(child1_allocation));
- flip_child (allocation, &(handle_allocation));
+ flip_child (width, &(child2_allocation));
+ flip_child (width, &(child1_allocation));
+ flip_child (width, &(handle_allocation));
}
if (child1_width > child1_allocation.width)
gint child1_height, child2_height;
gtk_widget_measure (priv->child1, GTK_ORIENTATION_VERTICAL,
- allocation->width,
+ width,
&child1_height, NULL, NULL, NULL);
gtk_widget_measure (priv->child2, GTK_ORIENTATION_VERTICAL,
- allocation->width,
+ width,
&child2_height, NULL, NULL, NULL);
gtk_paned_calc_position (paned,
- MAX (1, allocation->height - handle_size),
+ MAX (1, height - handle_size),
child1_height,
child2_height);
handle_allocation = (GdkRectangle){
0,
priv->child1_size,
- allocation->width,
+ width,
handle_size,
};
- child1_allocation.width = child2_allocation.width = allocation->width;
+ child1_allocation.width = child2_allocation.width = width;
child1_allocation.height = MAX (1, priv->child1_size);
child1_allocation.x = child2_allocation.x = 0;
child1_allocation.y = 0;
child2_allocation.y = child1_allocation.y + priv->child1_size + handle_size;
- child2_allocation.height = MAX (1, allocation->height - child2_allocation.y);
+ child2_allocation.height = MAX (1, height - child2_allocation.y);
if (child1_height > child1_allocation.height)
{
gtk_paned_set_child_visible (paned, CHILD1, TRUE);
gtk_paned_set_child_visible (paned, CHILD2, FALSE);
- gtk_widget_size_allocate (priv->child1, allocation, -1);
+ gtk_widget_size_allocate (priv->child1,
+ &(GtkAllocation) {0, 0, width, height}, -1);
}
else if (priv->child2 && gtk_widget_get_visible (priv->child2))
{
gtk_paned_set_child_visible (paned, CHILD1, FALSE);
gtk_paned_set_child_visible (paned, CHILD2, TRUE);
- gtk_widget_size_allocate (priv->child2, allocation, -1);
+ gtk_widget_size_allocate (priv->child2,
+ &(GtkAllocation) {0, 0, width, height}, -1);
+
}
else
{
int *minimum_baseline,
int *natural_baseline);
static void gtk_path_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline);
static void gtk_path_bar_add (GtkContainer *container,
GtkWidget *widget);
/* This is a tad complicated
*/
static void
-gtk_path_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_path_bar_size_allocate (GtkWidget *widget,
+ int widget_width,
+ int widget_height,
+ int baseline)
{
GtkPathBar *path_bar = GTK_PATH_BAR (widget);
GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (path_bar);
return;
direction = gtk_widget_get_direction (widget);
- allocation_width = allocation->width;
+ allocation_width = widget_width;
/* First, we check to see if we need the scrollbars. */
if (priv->fake_root)
}
/* Now, we allocate space to the buttons */
- child_allocation.y = allocation->y;
- child_allocation.height = allocation->height;
+ child_allocation.y = 0;
+ child_allocation.height = widget_height;
if (direction == GTK_TEXT_DIR_RTL)
{
- child_allocation.x = allocation->x + allocation->width;
+ child_allocation.x = widget_width;
if (need_sliders || priv->fake_root)
{
child_allocation.x -= priv->slider_width;
- up_slider_offset = allocation->width - priv->slider_width;
+ up_slider_offset = widget_width - priv->slider_width;
}
}
else
{
- child_allocation.x = allocation->x;
+ child_allocation.x = 0;
if (need_sliders || priv->fake_root)
{
up_slider_offset = 0;
if (direction == GTK_TEXT_DIR_RTL)
{
- down_slider_offset = child_allocation.x - allocation->x - priv->slider_width;
+ down_slider_offset = child_allocation.x - priv->slider_width;
}
else
{
if (need_sliders || priv->fake_root)
{
child_allocation.width = priv->slider_width;
- child_allocation.x = up_slider_offset + allocation->x;
+ child_allocation.x = up_slider_offset;
gtk_widget_size_allocate (priv->up_slider_button,
&child_allocation,
-1);
if (need_sliders)
{
child_allocation.width = priv->slider_width;
- child_allocation.x = down_slider_offset + allocation->x;
+ child_allocation.x = down_slider_offset;
gtk_widget_size_allocate (priv->down_slider_button,
&child_allocation,
}
static void
-allocate_contents (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline)
+allocate_contents (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline)
{
GtkPopover *popover = GTK_POPOVER (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover));
if (child)
- gtk_widget_size_allocate (child, allocation, -1);
+ gtk_widget_size_allocate (child,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, -1);
}
static void
}
static void
-gtk_popover_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_popover_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkPopover *popover = GTK_POPOVER (widget);
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
- GtkAllocation child_alloc = *allocation;
+ GtkAllocation child_alloc = (GtkAllocation) {0, 0, width, height};
/* Note that we in measure() we add TAIL_HEIGHT in both directions, regardless
* of the popovers position. This is to ensure that we get enough space
}
static void
-gtk_popover_parent_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline,
- GtkPopover *popover)
+gtk_popover_parent_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline,
+ GtkPopover *popover)
{
gtk_popover_update_position (popover);
}
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_progress_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_progress_bar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_progress_bar_act_mode_enter (GtkProgressBar *progress);
static void gtk_progress_bar_act_mode_leave (GtkProgressBar *progress);
}
static void
-allocate_trough (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline)
+allocate_trough (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline)
{
GtkProgressBar *pbar = GTK_PROGRESS_BAR (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
GtkAllocation alloc;
- gint width, height;
+ int progress_width, progress_height;
gboolean inverted;
inverted = priv->inverted;
}
gtk_widget_measure (priv->progress_widget, GTK_ORIENTATION_VERTICAL, -1,
- &height, NULL,
+ &progress_height, NULL,
NULL, NULL);
gtk_widget_measure (priv->progress_widget, GTK_ORIENTATION_HORIZONTAL, -1,
- &width, NULL,
+ &progress_width, NULL,
NULL, NULL);
if (priv->activity_mode)
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- alloc.width = width + (allocation->width - width) / priv->activity_blocks;
- alloc.x = allocation->x + priv->activity_pos * (allocation->width - alloc.width);
- alloc.y = allocation->y + (allocation->height - height) / 2;
- alloc.height = height;
+ alloc.width = progress_width + (width - progress_width) / priv->activity_blocks;
+ alloc.x = priv->activity_pos * (width - alloc.width);
+ alloc.y = (height - progress_height) / 2;
+ alloc.height = progress_height;
}
else
{
- alloc.height = height + (allocation->height - height) / priv->activity_blocks;
- alloc.y = allocation->y + priv->activity_pos * (allocation->height - alloc.height);
- alloc.x = allocation->x + (allocation->width - width) / 2;
- alloc.width = width;
+ alloc.height = progress_height + (height - progress_height) / priv->activity_blocks;
+ alloc.y = priv->activity_pos * (height - alloc.height);
+ alloc.x = (width - progress_width) / 2;
+ alloc.width = progress_width;
}
}
else
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- alloc.width = width + (allocation->width - width) * priv->fraction;
- alloc.height = height;
- alloc.y = allocation->y + (allocation->height - height) / 2;
+ alloc.width = progress_width + (width - progress_width) * priv->fraction;
+ alloc.height = progress_height;
+ alloc.y = (height - progress_height) / 2;
if (!inverted)
- alloc.x = allocation->x;
+ alloc.x = 0;
else
- alloc.x = allocation->x + allocation->width - alloc.width;
+ alloc.x = width - alloc.width;
}
else
{
- alloc.width = width;
- alloc.height = height + (allocation->height - height) * priv->fraction;
- alloc.x = allocation->x + (allocation->width - width) / 2;
+ alloc.width = progress_width;
+ alloc.height = progress_height + (height - progress_height) * priv->fraction;
+ alloc.x = (width - progress_width) / 2;
if (!inverted)
- alloc.y = allocation->y;
+ alloc.y = 0;
else
- alloc.y = allocation->y + allocation->height - alloc.height;
+ alloc.y = height - alloc.height;
}
}
- gtk_widget_size_allocate (priv->progress_widget, &alloc,-1);
+ gtk_widget_size_allocate (priv->progress_widget, &alloc, -1);
}
}
static void
-gtk_progress_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_progress_bar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (GTK_PROGRESS_BAR (widget));
gint bar_width, bar_height;
gtk_widget_measure (priv->trough_widget, GTK_ORIENTATION_VERTICAL, -1,
&bar_height, NULL,
NULL, NULL);
- bar_width = allocation->width;
+ bar_width = width;
}
else
{
gtk_widget_measure (priv->trough_widget, GTK_ORIENTATION_HORIZONTAL, -1,
&bar_width, NULL,
NULL, NULL);
- bar_height = allocation->height;
+ bar_height = height;
}
- alloc.x = allocation->x + allocation->width - bar_width;
- alloc.y = allocation->y + allocation->height - bar_height;
+ alloc.x = width - bar_width;
+ alloc.y = height - bar_height;
alloc.width = bar_width;
alloc.height = bar_height;
&text_height, NULL,
NULL, NULL);
- text_width = CLAMP (text_nat, text_min, allocation->width);
+ text_width = CLAMP (text_nat, text_min, width);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- alloc.x = allocation->x + (allocation->width - text_width) / 2;
- alloc.y = allocation->y;
+ alloc.x = (width - text_width) / 2;
+ alloc.y = 0;
alloc.width = text_width;
alloc.height = text_height;
}
else
{
- alloc.x = allocation->x + allocation->width - text_width;
- alloc.y = allocation->y + (allocation->height - text_height) / 2;
+ alloc.x = width - text_width;
+ alloc.y = (height - text_height) / 2;
alloc.width = text_width;
alloc.height = text_height;
}
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_range_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_range_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_range_unmap (GtkWidget *widget);
static void gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gint *minimum_baseline,
gint *natural_baseline);
static void gtk_range_allocate_trough (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline);
static gboolean gtk_range_render_trough (GtkGizmo *gizmo,
GtkSnapshot *snapshot);
}
static void
-gtk_range_allocate_trough (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline)
+gtk_range_allocate_trough (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline)
{
GtkWidget *widget = gtk_widget_get_parent (GTK_WIDGET (gizmo));
GtkRange *range = GTK_RANGE (widget);
double level, fill;
GtkAllocation fill_alloc;
- fill_alloc = *allocation;
+ fill_alloc = (GtkAllocation) {0, 0, width, height};
level = CLAMP (priv->fill_level, lower, upper - page_size);
fill_alloc.width *= fill;
if (should_invert (range))
- fill_alloc.x += allocation->width - fill_alloc.width;
+ fill_alloc.x += width - fill_alloc.width;
}
else
{
fill_alloc.height *= fill;
if (should_invert (range))
- fill_alloc.y += allocation->height - fill_alloc.height;
+ fill_alloc.y += height - fill_alloc.height;
}
gtk_widget_size_allocate (priv->fill_widget, &fill_alloc, -1);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- highlight_alloc.y = allocation->y;
- highlight_alloc.height = allocation->height;
+ highlight_alloc.y = 0;
+ highlight_alloc.height = height;
if (!should_invert (range))
- highlight_alloc.x = allocation->x;
+ highlight_alloc.x = 0;
else
- highlight_alloc.x = allocation->x + (allocation->width * (1 - value));
+ highlight_alloc.x = (width * (1 - value));
- highlight_alloc.width = MAX (min, allocation->width * value);
+ highlight_alloc.width = MAX (min, width * value);
}
else
{
- highlight_alloc.x = allocation->x;
- highlight_alloc.width = allocation->width;
+ highlight_alloc.x = 0;
+ highlight_alloc.width = width;
if (!should_invert (range))
- highlight_alloc.y = allocation->y;
+ highlight_alloc.y = 0;
else
- highlight_alloc.y = allocation->y + (allocation->height * (1 - value));
+ highlight_alloc.y = (height * (1 - value));
- highlight_alloc.height = MAX (min, allocation->height* value);
+ highlight_alloc.height = MAX (min, height * value);
}
gtk_widget_size_allocate (priv->highlight_widget, &highlight_alloc, -1);
* give space to border over dimensions in one direction.
*/
static void
-clamp_dimensions (const GtkAllocation *allocation,
- int *width,
- int *height,
- GtkBorder *border,
- gboolean border_expands_horizontally)
+clamp_dimensions (int range_width,
+ int range_height,
+ int *width,
+ int *height,
+ GtkBorder *border,
+ gboolean border_expands_horizontally)
{
gint extra, shortage;
/* Width */
- extra = allocation->width - border->left - border->right - *width;
+ extra = range_width - border->left - border->right - *width;
if (extra > 0)
{
if (border_expands_horizontally)
}
/* See if we can fit rect, if not kill the border */
- shortage = *width - allocation->width;
+ shortage = *width - range_width;
if (shortage > 0)
{
- *width = allocation->width;
+ *width = range_width;
/* lose the border */
border->left = 0;
border->right = 0;
else
{
/* See if we can fit rect with borders */
- shortage = *width + border->left + border->right - allocation->width;
+ shortage = *width + border->left + border->right - range_width;
if (shortage > 0)
{
/* Shrink borders */
}
/* Height */
- extra = allocation->height - border->top - border->bottom - *height;
+ extra = range_height - border->top - border->bottom - *height;
if (extra > 0)
{
if (border_expands_horizontally)
}
/* See if we can fit rect, if not kill the border */
- shortage = *height - allocation->height;
+ shortage = *height - range_height;
if (shortage > 0)
{
- *height = allocation->height;
+ *height = range_height;
/* lose the border */
border->top = 0;
border->bottom = 0;
else
{
/* See if we can fit rect with borders */
- shortage = *height + border->top + border->bottom - allocation->height;
+ shortage = *height + border->top + border->bottom - range_height;
if (shortage > 0)
{
/* Shrink borders */
}
static void
-gtk_range_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_range_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
NULL, NULL);
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
- clamp_dimensions (allocation, &box_min_width, &box_min_height, &border, TRUE);
+ clamp_dimensions (width, height, &box_min_width, &box_min_height, &border, TRUE);
else
- clamp_dimensions (allocation, &box_min_width, &box_min_height, &border, FALSE);
+ clamp_dimensions (width, height, &box_min_width, &box_min_height, &border, FALSE);
box_alloc.x = border.left;
box_alloc.y = border.top;
static void gtk_revealer_real_add (GtkContainer *widget,
GtkWidget *child);
-static void gtk_revealer_real_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_revealer_real_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_revealer_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
}
static void
-gtk_revealer_real_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_revealer_real_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkRevealer *revealer = GTK_REVEALER (widget);
GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (revealer));
if (child != NULL && gtk_widget_get_visible (child))
{
- GtkAllocation child_allocation;
+ GtkAllocation child_allocation = {0, 0, width, height};
double hscale, vscale;
- child_allocation = *allocation;
-
hscale = get_child_size_scale (revealer, GTK_ORIENTATION_HORIZONTAL);
vscale = get_child_size_scale (revealer, GTK_ORIENTATION_VERTICAL);
else if (hscale < 1.0)
{
g_assert (vscale == 1.0);
- child_allocation.width = MIN (G_MAXINT, ceil (child_allocation.width / hscale));
+ child_allocation.width = MIN (G_MAXINT, ceil (width / hscale));
if (effective_transition (revealer) == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
- child_allocation.x = allocation->width - child_allocation.width;
+ child_allocation.x = width - child_allocation.width;
}
else if (vscale < 1.0)
{
- child_allocation.height = MIN (G_MAXINT, ceil (child_allocation.height / vscale));
+ child_allocation.height = MIN (G_MAXINT, ceil (height / vscale));
if (effective_transition (revealer) == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
- child_allocation.y = allocation->height - child_allocation.height;
+ child_allocation.y = height - child_allocation.height;
}
gtk_widget_size_allocate (child, &child_allocation, -1);
}
}
static void
-gtk_scale_allocate_mark (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline)
+gtk_scale_allocate_mark (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline)
{
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkScale *scale = GTK_SCALE (gtk_widget_get_parent (gtk_widget_get_parent (widget)));
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- indicator_alloc.x = (allocation->width - indicator_width) / 2;
+ indicator_alloc.x = (width - indicator_width) / 2;
if (mark->position == GTK_POS_TOP)
- indicator_alloc.y = allocation->y + allocation->height - indicator_height;
+ indicator_alloc.y = height - indicator_height;
else
- indicator_alloc.y = allocation->y;
+ indicator_alloc.y = 0;
+
indicator_alloc.width = indicator_width;
indicator_alloc.height = indicator_height;
}
else
{
if (mark->position == GTK_POS_TOP)
- indicator_alloc.x = allocation->x + allocation->width - indicator_width;
+ indicator_alloc.x = width - indicator_width;
else
- indicator_alloc.x = allocation->x;
- indicator_alloc.y = (allocation->height - indicator_height) / 2;
+ indicator_alloc.x = 0;
+ indicator_alloc.y = (height - indicator_height) / 2;
indicator_alloc.width = indicator_width;
indicator_alloc.height = indicator_height;
}
{
GtkAllocation label_alloc;
- label_alloc = *allocation;
+ label_alloc = (GtkAllocation) {0, 0, width, height};
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- label_alloc.height = allocation->height - indicator_alloc.height;
+ label_alloc.height = height - indicator_alloc.height;
if (mark->position == GTK_POS_BOTTOM)
label_alloc.y = indicator_alloc.y + indicator_alloc.height;
}
else
{
- label_alloc.width = allocation->width - indicator_alloc.width;
+ label_alloc.width = width - indicator_alloc.width;
if (mark->position == GTK_POS_BOTTOM)
label_alloc.x = indicator_alloc.x + indicator_alloc.width;
}
}
static void
-gtk_scale_allocate_marks (GtkGizmo *gizmo,
- const GtkAllocation *allocation,
- int baseline)
+gtk_scale_allocate_marks (GtkGizmo *gizmo,
+ int width,
+ int height,
+ int baseline)
{
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkScale *scale = GTK_SCALE (gtk_widget_get_parent (widget));
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
mark_alloc.x = mark->stop_position;
- mark_alloc.y = allocation->y;
+ mark_alloc.y = 0;
mark_alloc.width = mark_size;
- mark_alloc.height = allocation->height;
+ mark_alloc.height = height;
mark_alloc.x -= mark_size / 2;
}
else
{
- mark_alloc.x = allocation->x;
+ mark_alloc.x = 0;
mark_alloc.y = mark->stop_position;
- mark_alloc.width = allocation->width;
+ mark_alloc.width = width;
mark_alloc.height = mark_size;
mark_alloc.y -= mark_size / 2;
}
static void
-gtk_scale_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_scale_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkScale *scale = GTK_SCALE (widget);
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
GtkAllocation range_rect, marks_rect;
GtkOrientation orientation;
- GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, allocation, baseline);
+ GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, width, height, baseline);
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
gtk_range_get_range_rect (GTK_RANGE (scale), &range_rect);
}
static void
-gtk_scrollbar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_scrollbar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkScrollbar *self = GTK_SCROLLBAR (widget);
GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self);
- gtk_widget_size_allocate (priv->box, allocation, -1);
+ gtk_widget_size_allocate (priv->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, -1);
}
static void
static void gtk_scrolled_window_destroy (GtkWidget *widget);
static void gtk_scrolled_window_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static gboolean gtk_scrolled_window_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_scrolled_window_add (GtkContainer *container,
GtkWidget *scrollbar,
GtkAllocation *allocation);
static void gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
- const GtkAllocation *content_allocation);
+ int width,
+ int height);
static void gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
gpointer data);
static void gtk_scrolled_window_adjustment_value_changed (GtkAdjustment *adjustment,
}
static void
-gtk_scrolled_window_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_scrolled_window_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
* given the extra width of the scrollbar */
if (vscroll_policy == GTK_SCROLL_MINIMUM)
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL,
- MAX (allocation->width, child_scroll_width),
+ MAX (width, child_scroll_width),
&child_scroll_height, NULL, NULL, NULL);
else
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL,
- MAX (allocation->width, child_scroll_width),
+ MAX (width, child_scroll_width),
NULL, &child_scroll_height, NULL, NULL);
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
{
/* Does the content height fit the allocation height ? */
- priv->vscrollbar_visible = child_scroll_height > allocation->height;
+ priv->vscrollbar_visible = child_scroll_height > height;
/* Does the content width fit the allocation with minus a possible scrollbar ? */
- priv->hscrollbar_visible =
- child_scroll_width > allocation->width -
+ priv->hscrollbar_visible = child_scroll_width > width -
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
/* Now that we've guessed the hscrollbar, does the content height fit
* the possible new allocation height ?
*/
- priv->vscrollbar_visible =
- child_scroll_height > allocation->height -
+ priv->vscrollbar_visible = child_scroll_height > height -
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
/* Now that we've guessed the vscrollbar, does the content width fit
* the possible new allocation width ?
*/
- priv->hscrollbar_visible =
- child_scroll_width > allocation->width -
+ priv->hscrollbar_visible = child_scroll_width > width -
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
}
else /* priv->hscrollbar_policy != GTK_POLICY_AUTOMATIC */
{
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
- priv->vscrollbar_visible = child_scroll_height > allocation->height -
+ priv->vscrollbar_visible = child_scroll_height > height -
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
}
}
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
- priv->hscrollbar_visible =
- child_scroll_width > allocation->width -
+ priv->hscrollbar_visible = child_scroll_width > width -
(priv->vscrollbar_visible && !priv->use_indicators ? 0 : sb_width);
else
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
* given the extra height of the scrollbar */
if (hscroll_policy == GTK_SCROLL_MINIMUM)
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL,
- MAX (allocation->height, child_scroll_height),
+ MAX (height, child_scroll_height),
&child_scroll_width, NULL, NULL, NULL);
else
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL,
- MAX (allocation->height, child_scroll_height),
+ MAX (height, child_scroll_height),
NULL, &child_scroll_width, NULL, NULL);
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
{
/* Does the content width fit the allocation width ? */
- priv->hscrollbar_visible = child_scroll_width > allocation->width;
+ priv->hscrollbar_visible = child_scroll_width > width;
/* Does the content height fit the allocation with minus a possible scrollbar ? */
- priv->vscrollbar_visible =
- child_scroll_height > allocation->height -
+ priv->vscrollbar_visible = child_scroll_height > height -
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
/* Now that we've guessed the vscrollbar, does the content width fit
* the possible new allocation width ?
*/
- priv->hscrollbar_visible =
- child_scroll_width > allocation->width -
+ priv->hscrollbar_visible = child_scroll_width > width -
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
/* Now that we've guessed the hscrollbar, does the content height fit
* the possible new allocation height ?
*/
- priv->vscrollbar_visible =
- child_scroll_height > allocation->height -
+ priv->vscrollbar_visible = child_scroll_height > height -
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
}
else /* priv->vscrollbar_policy != GTK_POLICY_AUTOMATIC */
{
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
- priv->hscrollbar_visible = child_scroll_width > allocation->width -
+ priv->hscrollbar_visible = child_scroll_width > width -
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
}
}
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
- priv->vscrollbar_visible =
- child_scroll_height > allocation->height -
+ priv->vscrollbar_visible = child_scroll_height > height -
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
else
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
previous_hvis = priv->hscrollbar_visible;
previous_vvis = priv->vscrollbar_visible;
- gtk_scrolled_window_allocate_child (scrolled_window, allocation);
+ gtk_scrolled_window_allocate_child (scrolled_window, width, height);
/* Explicitly force scrollbar visibility checks.
*
priv->hscrollbar_visible = TRUE;
priv->vscrollbar_visible = TRUE;
- gtk_scrolled_window_allocate_child (scrolled_window, allocation);
+ gtk_scrolled_window_allocate_child (scrolled_window, width, height);
break;
}
static void
gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
- const GtkAllocation *content_allocation)
+ int width,
+ int height)
{
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (swindow);
GtkWidget *widget = GTK_WIDGET (swindow), *child;
child = gtk_bin_get_child (GTK_BIN (widget));
- child_allocation = *content_allocation;
+ child_allocation = (GtkAllocation) {0, 0, width, height};
/* Get possible scrollbar dimensions */
gtk_widget_measure (priv->vscrollbar, GTK_ORIENTATION_HORIZONTAL, -1,
}
static void
-gtk_search_bar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_search_bar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkSearchBar *bar = GTK_SEARCH_BAR (widget);
GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
- gtk_widget_size_allocate (priv->revealer, allocation, baseline);
+ gtk_widget_size_allocate (priv->revealer,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
}
static void
-gtk_shortcuts_shortcut_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_shortcuts_shortcut_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
- GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, allocation, baseline);
+ GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, width, height, baseline);
- gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box), allocation, -1);
+ gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box),
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, -1);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_spin_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_spin_button_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_spin_button_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void gtk_spin_button_state_flags_changed (GtkWidget *widget,
}
static void
-gtk_spin_button_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_spin_button_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (GTK_SPIN_BUTTON (widget));
- gtk_widget_size_allocate (priv->box, allocation, baseline);
+ gtk_widget_size_allocate (priv->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ },
+ baseline);
}
static void
static void gtk_stack_compute_expand (GtkWidget *widget,
gboolean *hexpand,
gboolean *vexpand);
-static void gtk_stack_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_stack_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_stack_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_stack_measure (GtkWidget *widget,
}
static void
-gtk_stack_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_stack_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkStack *stack = GTK_STACK (widget);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
gtk_widget_measure (priv->last_visible_child->widget, GTK_ORIENTATION_HORIZONTAL,
-1,
&min, &nat, NULL, NULL);
- child_allocation.width = MAX (min, allocation->width);
+ child_allocation.width = MAX (min, width);
gtk_widget_measure (priv->last_visible_child->widget, GTK_ORIENTATION_VERTICAL,
child_allocation.width,
&min, &nat, NULL, NULL);
- child_allocation.height = MAX (min, allocation->height);
+ child_allocation.height = MAX (min, height);
gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation, -1);
}
}
- child_allocation.width = allocation->width;
- child_allocation.height = allocation->height;
+ child_allocation.width = width;
+ child_allocation.height = height;
if (priv->visible_child)
{
int min_height;
gtk_widget_measure (priv->visible_child->widget, GTK_ORIENTATION_HORIZONTAL,
- allocation->height, &min_width, NULL, NULL, NULL);
+ height, &min_width, NULL, NULL, NULL);
child_allocation.width = MAX (child_allocation.width, min_width);
gtk_widget_measure (priv->visible_child->widget, GTK_ORIENTATION_VERTICAL,
child_allocation.width, &min_height, NULL, NULL, NULL);
child_allocation.height = MAX (child_allocation.height, min_height);
- if (child_allocation.width > allocation->width)
+ if (child_allocation.width > width)
{
GtkAlign halign = gtk_widget_get_halign (priv->visible_child->widget);
if (halign == GTK_ALIGN_CENTER || halign == GTK_ALIGN_FILL)
- child_allocation.x = (allocation->width - child_allocation.width) / 2;
+ child_allocation.x = (width - child_allocation.width) / 2;
else if (halign == GTK_ALIGN_END)
- child_allocation.x = (allocation->width - child_allocation.width);
+ child_allocation.x = (width - child_allocation.width);
}
- if (child_allocation.height > allocation->height)
+ if (child_allocation.height > height)
{
GtkAlign valign = gtk_widget_get_valign (priv->visible_child->widget);
if (valign == GTK_ALIGN_CENTER || valign == GTK_ALIGN_FILL)
- child_allocation.y = (allocation->height - child_allocation.height) / 2;
+ child_allocation.y = (height - child_allocation.height) / 2;
else if (valign == GTK_ALIGN_END)
- child_allocation.y = (allocation->height - child_allocation.height);
+ child_allocation.y = (height - child_allocation.height);
}
gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation, -1);
}
static void
-gtk_statusbar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_statusbar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkStatusbarPrivate *priv = gtk_statusbar_get_instance_private (GTK_STATUSBAR (widget));
- gtk_widget_size_allocate (priv->frame, allocation, baseline);
+ gtk_widget_size_allocate (priv->frame,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
}
static void
-gtk_switch_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_switch_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkSwitch *self = GTK_SWITCH (widget);
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
GtkAllocation slider_alloc;
int min;
- slider_alloc.x = round (priv->handle_pos * (allocation->width / 2));
+ slider_alloc.x = round (priv->handle_pos * (width / 2));
slider_alloc.y = 0;
- slider_alloc.width = allocation->width / 2;
- slider_alloc.height = allocation->height;
+ slider_alloc.width = width / 2;
+ slider_alloc.height = height;
gtk_widget_size_allocate (priv->slider, &slider_alloc, -1);
/* Center ON label in left half */
gtk_widget_measure (priv->on_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
- child_alloc.x = ((allocation->width / 2) - min) / 2;
+ child_alloc.x = ((width / 2) - min) / 2;
child_alloc.width = min;
gtk_widget_measure (priv->on_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
- child_alloc.y = (allocation->height - min) / 2;
+ child_alloc.y = (height - min) / 2;
child_alloc.height = min;
gtk_widget_size_allocate (priv->on_label, &child_alloc, -1);
/* Center OFF label in right half */
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
- child_alloc.x = (allocation->width / 2) + ((allocation->width / 2) - min) / 2;
+ child_alloc.x = (width / 2) + ((width / 2) - min) / 2;
child_alloc.width = min;
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
- child_alloc.y = (allocation->height - min) / 2;
+ child_alloc.y = (height - min) / 2;
child_alloc.height = min;
gtk_widget_size_allocate (priv->off_label, &child_alloc, -1);
}
int *minimum_baseline,
int *natural_baseline);
static void gtk_text_view_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline);
static void gtk_text_view_realize (GtkWidget *widget);
static void gtk_text_view_unrealize (GtkWidget *widget);
}
static void
-gtk_text_view_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_text_view_size_allocate (GtkWidget *widget,
+ int widget_width,
+ int widget_height,
+ int baseline)
{
GtkTextView *text_view;
GtkTextViewPrivate *priv;
*/
left_rect.width = priv->border_window_size.left;
right_rect.width = priv->border_window_size.right;
- width = allocation->width - left_rect.width - right_rect.width;
+ width = widget_width - left_rect.width - right_rect.width;
text_rect.width = MAX (1, width);
top_rect.width = text_rect.width;
bottom_rect.width = text_rect.width;
top_rect.height = priv->border_window_size.top;
bottom_rect.height = priv->border_window_size.bottom;
- height = allocation->height - top_rect.height - bottom_rect.height;
+ height = widget_height - top_rect.height - bottom_rect.height;
text_rect.height = MAX (1, height);
left_rect.height = text_rect.height;
right_rect.height = text_rect.height;
static void gtk_toolbar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_toolbar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline);
static void gtk_toolbar_style_updated (GtkWidget *widget);
static gboolean gtk_toolbar_focus (GtkWidget *widget,
}
static void
-gtk_toolbar_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_toolbar_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
GtkToolbarPrivate *priv = toolbar->priv;
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- available_size = size = allocation->width;
- short_size = allocation->height;
+ available_size = size = width;
+ short_size = height;
arrow_size = arrow_requisition.width;
}
else
{
- available_size = size = allocation->height;
- short_size = allocation->width;
+ available_size = size = height;
+ short_size = width;
arrow_size = arrow_requisition.height;
}
fixup_allocation_for_rtl (available_size, &item_area);
}
- /* translate the items by allocation->(x,y) */
- for (i = 0; i < n_items; ++i)
- {
- allocations[i].x += allocation->x;
- allocations[i].y += allocation->y;
- }
-
- if (need_arrow)
- {
- arrow_allocation.x += allocation->x;
- arrow_allocation.y += allocation->y;
- }
-
- item_area.x += allocation->x;
- item_area.y += allocation->y;
-
/* did anything change? */
for (list = priv->content, i = 0; list != NULL; list = list->next, i++)
{
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_tree_view_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_tree_view_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_tree_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
}
static void
-gtk_tree_view_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_tree_view_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *tmp_list;
page_size = gtk_adjustment_get_page_size (tree_view->priv->vadjustment);
gtk_adjustment_configure (tree_view->priv->hadjustment,
gtk_adjustment_get_value (tree_view->priv->hadjustment) +
- (_gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL ? allocation->width - page_size : 0),
+ (_gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL ? width - page_size : 0),
0,
- MAX (allocation->width, tree_view->priv->width),
- allocation->width * 0.1,
- allocation->width * 0.9,
- allocation->width);
+ MAX (width, tree_view->priv->width),
+ width * 0.1,
+ width * 0.9,
+ width);
- page_size = allocation->height - gtk_tree_view_get_effective_header_height (tree_view);
+ page_size = height - gtk_tree_view_get_effective_header_height (tree_view);
gtk_adjustment_configure (tree_view->priv->vadjustment,
gtk_adjustment_get_value (tree_view->priv->vadjustment),
0,
* or top right corner (for LTR)
*/
min_x = gtk_adjustment_get_value (tree_view->priv->hadjustment);
- max_x = min_x + allocation->width - child_rect.width;
+ max_x = min_x + width - child_rect.width;
min_y = 0;
- max_y = min_y + allocation->height - gtk_tree_view_get_effective_header_height (tree_view) - child_rect.height;
+ max_y = min_y + height - gtk_tree_view_get_effective_header_height (tree_view) - child_rect.height;
if (direction == GTK_TEXT_DIR_LTR)
/* Ensure that child's right edge is not sticking to the right
}
static void
-gtk_video_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_video_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkVideo *self = GTK_VIDEO (widget);
- gtk_widget_size_allocate (self->box, allocation, baseline);
+ gtk_widget_size_allocate (self->box,
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
static void gtk_viewport_destroy (GtkWidget *widget);
static void gtk_viewport_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_viewport_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_viewport_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
static void viewport_set_adjustment (GtkViewport *viewport,
}
static void
-gtk_viewport_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_viewport_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkViewport *viewport = GTK_VIEWPORT (widget);
GtkViewportPrivate *priv = gtk_viewport_get_instance_private (viewport);
static void gtk_widget_real_unmap (GtkWidget *widget);
static void gtk_widget_real_realize (GtkWidget *widget);
static void gtk_widget_real_unrealize (GtkWidget *widget);
-static void gtk_widget_real_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline);
+static void gtk_widget_real_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline);
static void gtk_widget_real_direction_changed(GtkWidget *widget,
GtkTextDirection previous_direction);
G_STRUCT_OFFSET (GtkWidgetClass, size_allocate),
NULL, NULL,
NULL,
- G_TYPE_NONE, 2,
- GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_NONE, 3,
+ G_TYPE_INT,
+ G_TYPE_INT,
G_TYPE_INT);
/**
if (g_signal_has_handler_pending (widget, widget_signals[SIZE_ALLOCATE], 0, FALSE))
g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0,
- &real_allocation,
+ real_allocation.width,
+ real_allocation.height,
baseline);
else
GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget,
- &real_allocation,
+ real_allocation.width,
+ real_allocation.height,
baseline);
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
}
static void
-gtk_widget_real_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_widget_real_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
void (* realize) (GtkWidget *widget);
void (* unrealize) (GtkWidget *widget);
void (* size_allocate) (GtkWidget *widget,
- const GtkAllocation *allocation,
+ int width,
+ int height,
int baseline);
void (* state_flags_changed) (GtkWidget *widget,
GtkStateFlags previous_state_flags);
static void gtk_window_unmap (GtkWidget *widget);
static void gtk_window_realize (GtkWidget *widget);
static void gtk_window_unrealize (GtkWidget *widget);
-static void gtk_window_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
+static void gtk_window_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
int baseline);
static gboolean gtk_window_close_request (GtkWindow *window);
static void gtk_window_focus_in (GtkWidget *widget);
*/
void
_gtk_window_set_allocation (GtkWindow *window,
- const GtkAllocation *allocation,
+ int width,
+ int height,
GtkAllocation *allocation_out)
{
GtkWidget *widget = (GtkWidget *)window;
GtkBorder window_border = { 0 };
GList *link;
- g_assert (allocation != NULL);
g_assert (allocation_out != NULL);
child_allocation.x = 0;
child_allocation.y = 0;
- child_allocation.width = allocation->width;
- child_allocation.height = allocation->height;
+ child_allocation.width = width;
+ child_allocation.height = height;
get_shadow_width (window, &window_border);
title_allocation.x = window_border.left;
title_allocation.y = window_border.top;
- title_allocation.width =
- MAX (1, (gint) allocation->width -
- window_border.left - window_border.right);
+ title_allocation.width = MAX (1, width - window_border.left - window_border.right);
gtk_widget_measure (priv->title_box, GTK_ORIENTATION_VERTICAL,
title_allocation.width,
if (!_gtk_widget_is_toplevel (widget) && _gtk_widget_get_realized (widget))
{
- gdk_surface_move_resize (_gtk_widget_get_surface (widget),
- allocation->x, allocation->y,
- allocation->width, allocation->height);
+ gdk_surface_move_resize (_gtk_widget_get_surface (widget), 0, 0, width, height);
}
*allocation_out = child_allocation;
}
static void
-gtk_window_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_window_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWidget *child;
GtkAllocation child_allocation;
- _gtk_window_set_allocation (window, allocation, &child_allocation);
+ _gtk_window_set_allocation (window, width, height, &child_allocation);
child = gtk_bin_get_child (GTK_BIN (window));
if (child && gtk_widget_get_visible (child))
void _gtk_window_set_is_active (GtkWindow *window,
gboolean is_active);
-void _gtk_window_set_allocation (GtkWindow *window,
- const GtkAllocation *allocation,
- GtkAllocation *allocation_out);
+void _gtk_window_set_allocation (GtkWindow *window,
+ int width,
+ int height,
+ GtkAllocation *allocation_out);
typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window,
guint keyval,
}
static void
-gtk_stack_combo_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_stack_combo_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkStackCombo *self = GTK_STACK_COMBO (widget);
- gtk_widget_size_allocate (GTK_WIDGET (self->combo), allocation, baseline);
+
+ gtk_widget_size_allocate (GTK_WIDGET (self->combo),
+ &(GtkAllocation) {
+ 0, 0,
+ width, height
+ }, baseline);
}
static void
static void
allocation_changed (GtkWidget *w,
- GdkRectangle *allocation,
+ int width,
+ int height,
int baseline,
GtkInspectorMiscInfo *sl)
{
state_flags_changed (GTK_WIDGET (sl->priv->object), 0, sl);
g_signal_connect_object (object, "size-allocate", G_CALLBACK (allocation_changed), sl, 0);
- allocation_changed (GTK_WIDGET (sl->priv->object), NULL, -1, sl);
+ allocation_changed (GTK_WIDGET (sl->priv->object), 0, 0, -1, sl);
}
else
{
G_DEFINE_TYPE(GtkFocusWidget, gtk_focus_widget, GTK_TYPE_WIDGET)
static void
-gtk_focus_widget_size_allocate (GtkWidget *widget,
- const GtkAllocation *allocation,
- int baseline)
+gtk_focus_widget_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkFocusWidget *self = GTK_FOCUS_WIDGET (widget);
- int child_width = (allocation->width) / 2;
- int child_height = (allocation->height) / 2;
+ int child_width = width / 2;
+ int child_height = height / 2;
GtkAllocation child_alloc;
child_alloc.x = 0;